package connect4client.commands;

import messages.LoginFailedMessage;

/**
 * The LoginFailed command.
 * 
 * This command will handle Invite messages.
 */
public class LoginFailedCommand extends Command {

	public LoginFailedCommand(LoginFailedMessage loginFailedMessage){
		super(loginFailedMessage);
	}
	
	@Override
	public void execute() {			
		LoginFailedMessage message = (LoginFailedMessage) this.message;
		if (message.getOriginalMessage().getLogin().equals(controller.getUser().getLogin())) {
			guiMediator.loginFailed();
			controller.getMessageManager().restartMessageCounter();
		} else {
			System.err.println("Login failed for " + message.getOriginalMessage().getLogin());
		}
	}
}
